import request from '@/utils/request'
import {
  handleRequest
} from './index'
import {
  commercialApiUrl,
  projectApiUrl
} from '../config'
//总包结算策划列表
export function getSettlementPlanningList(data) {
  return request({
    url: commercialApiUrl + '/total-settlement/settlement-plan/query',
    method: 'post',
    data: data
  })
}

//总包结算策划列表
export function getSettlementPlanningListCount(data) {
  return request({
    url: commercialApiUrl + '/total-settlement/settlement-plan/query/count',
    method: 'post',
    data: data
  })
}

//工程总包结算责任列表
export function getProjectPlanningList(data) {
  return request({
    url: commercialApiUrl + '/merchant/settlement-targetresp/query',
    method: 'post',
    data: data
  })
}

//工程总包结算责任列表统计
export function getProjectPlanningFindListCount(data) {
  return request({
    url: commercialApiUrl + '/merchant/settlement-targetresp/findListCount',
    method: 'post',
    data: data
  })
}



//总包结算报送审批服务API
export function getProjectTotalApprovalList(data) {
  return request({
    url: commercialApiUrl + '/total-settlement/settlement/query',
    method: 'post',
    data: data
  })
}
//新增总包结算策划
export function addSettlementPlanning(data) {
  return request({
    url: commercialApiUrl + '/total-settlement/settlement-plan',
    method: 'post',
    data: data
  })
}


//新增总包结算报送
export function addProjectTotalApproval(data) {
  return request({
    url: commercialApiUrl + '/total-settlement/settlement',
    method: 'post',
    data: data
  })
}


//新增工程总包结算责任
export function addProjectSettlement(data) {
  return request({
    url: commercialApiUrl + '/merchant/settlement-targetresp',
    method: 'post',
    data: data
  })
}

//查看总包结算策划
export function getSettlementPlan(data) {
  return request({
    url: commercialApiUrl + '/total-settlement/settlement-plan/query',
    method: 'get',
    params: data
  })
}



//查看工程总包结算责任
export function getProjectSettlement(data) {
  return request({
    url: commercialApiUrl + '/merchant/settlement-targetresp/detail',
    method: 'get',
    params: data
  })
}

//查看工程总包结算报送
export function getProjectTotalApproval(data) {
  return request({
    url: commercialApiUrl + '/total-settlement/settlement/query',
    method: 'get',
    params: data
  })
}

//更新总包结算策划
export function updateSettlementPlanning(data) {
  return request({
    url: commercialApiUrl + '/total-settlement/settlement-plan/update',
    method: 'post',
    data
  })
}


//编辑工程总包结算责任
export function updateProjectSettlement(data) {
  return request({
    url: commercialApiUrl + '/merchant/settlement-targetresp/update',
    method: 'post',
    data
  })
}

//更新工程总包结算报送
export function updateProjectTotalApproval(data) {
  return request({
    url: commercialApiUrl + '/total-settlement/settlement/update',
    method: 'post',
    data
  })
}

//删除总包结算策划
export function deleteSettlementPlanning(data) {
  return request({
    url: commercialApiUrl + '/total-settlement/settlement-plan/del',
    method: 'post',
    params: data
  })
}
//删除工程总包结算责任
export function deleteProjectSettlement(data) {
  return request({
    url: commercialApiUrl + '/merchant/settlement-targetresp/del',
    method: 'post',
    params: data
  })
}

//删除工程总包结算报送
export function deleteProjectTotalApproval(data) {
  return request({
    url: commercialApiUrl + '/total-settlement/settlement/del',
    method: 'post',
    params: data
  })
}

export function getProjectInfo(data) {
  return request({
    url: projectApiUrl + '/projects/details',
    method: 'get',
    params: data
  })
}
//获取部门列表
export function getDepartmentList(data) {
  return request({
    url: 'ycloud-organization' + '/orgs/children',
    method: 'get',
    params: data
  })
}

//获取部门下人员列表
export function getEmployees(data) {
  return request({
    url: 'ycloud-organization' + '/employees/pages-by-org',
    method: 'post',
    data: data
  })
}

// 总承包管理费

//获取-总承包管理费列表
export function getContractList(query) {
  return handleRequest({
    url: '/cost-contract/list',
    method: 'post',
    data: query
  })
}
//新增/修改-总承包管理费
export function addContract(query) {
  return handleRequest({
    url: '/cost-contract/addOrUpdate',
    method: 'post',
    data: query
  })
}

//删除-总承包管理费
export function delContract(query) {
  return handleRequest({
    url: '/cost-contract/delData',
    method: 'get',
    params: query
  })
}

//查看-总承包管理费
export function getContract(query) {
  return handleRequest({
    url: '/cost-contract/detail?id=' + query,
    method: 'get',

  })
}


// 成本分析审核

//获取-获取成本分析审核列表
export function getCostAnalysisAudit(query) {
  return handleRequest({
    url: '/costAnalysis-form/review/query',
    method: 'post',
    data: query
  })
}

//获取-获取成本分析审核列表统计
export function getCostAnalysisAuditCount(query) {
  return handleRequest({
    url: '/costAnalysis-form/review/query/count',
    method: 'post',
    data: query
  })
}

//获取-获取成本分析模板列表
export function getCostAnalysisAuditTem(query) {
  return handleRequest({
    url: '/costAnalysis-form/template/query',
    method: 'post',
    data: query
  })
}
//计算-成本分析模板列表
export function changeCostAnalysisAuditTem(query) {
  return handleRequest({
    url: '/costAnalysis-form/calculationAmount',
    method: 'post',
    data: query
  })
}


//新增-成本分析审核
export function addCostAnalysisAudit(query) {
  return handleRequest({
    url: '/costAnalysis-form/review',
    method: 'post',
    data: query
  })
}

//修改-成本分析审核
export function editCostAnalysisAudit(query) {
  return handleRequest({
    url: '/costAnalysis-form/review/update',
    method: 'post',
    data: query
  })
}
//删除-成本分析审核
export function delCostAnalysisAudit(query) {
  return handleRequest({
    url: '/costAnalysis-form/review/del',
    method: 'post',
    params: query
  })
}
//撤销-成本分析审核
export function cancelCostAnalysisAudit(query) {
  return handleRequest({
    url: '/costAnalysis-form/cancel',
    method: 'post',
    data: query
  })
}
//新增-查询基础信息
export function getProjectSum(query) {
  return handleRequest({
    url: '/costAnalysis-form/review/projectSum',
    method: 'post',
    data: query
  })
}
//查看-成本分析审核
export function checkCostAnalysisAudit(query) {
  return handleRequest({
    url: '/costAnalysis-form/review/query',
    method: 'get',
    params: query
  })
}


//获取-项目成本还原、总结列表

export function getCostReduction(query) {
  return handleRequest({
    url: '/cost-reduction/summary/query',
    method: 'post',
    data: query
  })
}


//新增-项目成本还原、总结
export function addCostReduction(query) {

  return handleRequest({
    url: '/cost-reduction/summary',
    method: 'post',
    data: query
  })
}

//修改-项目成本还原、总结
export function editCostReduction(query) {

  return handleRequest({
    url: '/cost-reduction/summary/update',
    method: 'post',
    data: query
  })
}
//删除-项目成本还原、总结
export function delCostReduction(query) {
  return handleRequest({
    url: '/cost-reduction/summary/del',
    method: 'post',
    params: query
  })
}
//作废/撤销-项目成本还原、总结
export function cancelCostReduction(query) {
  return handleRequest({
    url: '/cost-reduction/cancel',
    method: 'post',
    data: query
  })
}
//查看-项目成本还原、总结
export function checkCostReduction(query) {
  return handleRequest({
    url: '/cost-reduction/summary/query',
    method: 'get',
    params: query
  })
}

/**
 * 总包结算统计
 */
export function getSettlementTotalCount(data) {
  return handleRequest({
    url: '/total-settlement/settlement/count',
    method: 'post',
    data
  })
}
/**
 * 总包结算 - 期中结算报送 - API
 */
//列表
export function getSubmissionList(data) {
  return handleRequest({
    url: '/mid-submission/list',
    method: 'post',
    data: data
  })
}

//列表
export function getSubmissionNameList(data) {
  return handleRequest({
    url: '/approval-term/mid-list',
    method: 'post',
    data: data
  })
}

//统计
export function getSubmissionCount(data) {
  return handleRequest({
    url: '/mid-submission/count',
    method: 'post',
    data: data
  })
}


//删除
export function delSubmission(query) {
  return handleRequest({
    url: '/mid-submission/delData',
    method: 'get',
    params: query
  })
}

//新增or修改
export function addOrUpdateSubmission(data) {
  return handleRequest({
    url: '/mid-submission/addOrUpdate',
    method: 'post',
    data: data
  })
}
//查看
export function getSubmission(query) {
  return handleRequest({
    url: '/mid-submission/detail',
    method: 'get',
    params: query
  })
}

//检测名字是否重复
export function checkName(query) {
  return handleRequest({
    url: '/mid-submission/checkName',
    method: 'get',
    params: query
  })
}

/**
 * 总包结算 - 期中结算定案 - API
 */
//列表
export function getApprovalTermList(data) {
  return handleRequest({
    url: '/approval-term/list',
    method: 'post',
    data: data
  })
}

//统计
export function getApprovalTermCount(data) {
  return handleRequest({
    url: '/approval-term/count',
    method: 'post',
    data: data
  })
}


//删除
export function delApprovalTerm(query) {
  return handleRequest({
    url: '/approval-term/delData',
    method: 'get',
    params: query
  })
}

//新增
export function addApprovalTerm(data) {
  return handleRequest({
    url: '/approval-term/save',
    method: 'post',
    data: data
  })
}
//修改
export function updateApprovalTerm(data) {
  return handleRequest({
    url: '/approval-term/update',
    method: 'post',
    data: data
  })
}
//查看
export function getApprovalTerm(query) {
  return handleRequest({
    url: '/approval-term/detail',
    method: 'get',
    params: query
  })
}

// 成本与还远统计
export function getCountList(data) {
  return handleRequest({
    url: '/cost-reduction/summary/count',
    method: 'post',
    data: data
  })
}